<%@ tag description="Allows a registered user to change his data" pageEncoding="ISO-8859-1" %>
<%@ taglib prefix="iwebmvc" uri="http://tags.iwebmvc.com" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
<c-rt:set var="sessionUser" value="<%= org.internna.iwebmvc.security.UserManager.SESSION_USER %>" />
<c-rt:set var="userTrackerClass" value="<%= org.internna.iwebjtracker.model.TrackerUser.class %>" />
<c-rt:set var="userTracker" value="<%= org.internna.iwebjtracker.spring.mvc.IWebJTrackerModelDecoratorInterceptor.TRACKER_USER %>" />
<div style="text-align:left;width:505px;">
    <div id="editProfileTabContainer" dojoType="dijit.layout.TabContainer" style="width:100%;height:125px" tabPosition="left-h">
        <div dojoType="dijit.layout.ContentPane" closable="false" title="<iwebmvc:message argMessage="ui.profile.edit.tabs.offline" />">
            <iwebmvc:textbox path="profileName" required="true" maxLength="50" labelText="org.internna.iwebmvc.model.security.UserImpl.name" value="${sessionScope[sessionUser].name}" />
            <iwebmvc:combo id="profile" entity="${requestScope[userTracker]}" entityClass="${userTrackerClass}" path="sex" rows="5" />
            <iwebmvc:locator entity="${requestScope[userTracker]}" entityClass="${userTrackerClass}" path="location" currentDepthLevel="0" pages="5" baseColumnWidth="100" rows="10" labelCssStyle="padding-top:5px" />
            <div style="text-align:right;padding-top:5px;width:100%">
                <span id="profileOfflineValidation" class="validationWarning"></span>
                <iwebmvc:button label="ui.profile.offline.save" buttonIcon="/resource.iwebmvc?file=/images/offlineid.png">
                    saveOfflineData();
                </iwebmvc:button>
            </div>
        </div>
        <div dojoType="dijit.layout.ContentPane" closable="false" title="<iwebmvc:message argMessage="ui.profile.edit.tabs.online" />">
            <iwebmvc:textbox path="profileEmail" required="true" maxLength="60" labelText="org.internna.iwebmvc.model.security.UserImpl.email" regexp='^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$' value="${sessionScope[sessionUser].email}" />
            <span style="display:inline-block">
                <label for="themeSelector" class="label"><iwebmvc:message argMessage="org.internna.iwebmvc.model.security.UserImpl.theme" /></label>
                <select id="themeSelector" name="themeSelector" dojoType="dijit.form.FilteringSelect" autoComplete="true" required="true">
                    <option value="none"></option>
                    <option value="soria" <c:if test='${sessionScope[sessionUser].theme == "soria"}'>selected</c:if>>Soria</option>
                    <option value="tundra" <c:if test='${sessionScope[sessionUser].theme == "tundra"}'>selected</c:if>>Tundra</option>
                    <option value="nihilo" <c:if test='${sessionScope[sessionUser].theme == "nihilo"}'>selected</c:if>>Nihilo</option>
                </select>
            </span>
            <span style="display:inline-block;padding-top:5px">
                <label for="languageSelector" class="label"><iwebmvc:message argMessage="org.internna.iwebmvc.model.security.UserImpl.locale" /></label>
                <select id="languageSelector" name="languageSelector" dojoType="dijit.form.FilteringSelect" autoComplete="true" required="true">
                    <option value="none"></option>
                    <c:forEach items='${requestScope["supportedLocales"]}' var="locale">
                        <option value="${locale}" <c:if test='${sessionScope[sessionUser].locale == locale}'>selected</c:if>><iwebmvc:message argMessage="${locale}" /></option>
                    </c:forEach>
                </select>
            </span>
            <div style="text-align:right;padding-top:5px;width:100%">
                <span id="profilePreferencesValidation" class="validationWarning"></span>
                <iwebmvc:button label="ui.profile.online.save" buttonIcon="/resource.iwebmvc?file=/images/preferences.png">
                    savePreferencesData("<iwebmvc:message argMessage="ui.registration.errorData" />");
                </iwebmvc:button>
            </div>
        </div>
        <div dojoType="dijit.layout.ContentPane" closable="false" title="<iwebmvc:message argMessage="ui.profile.edit.tabs.security" />">
            <iwebmvc:textbox path="profilePassword" required="true" regexp="[\w]{6,}" maxLength="20" labelText="iwebmvc.ui.login.password" password="true" />
            <div style="text-align:right;padding-top:5px;width:100%;padding-top:45px">
                <span id="profileSecurityValidation" class="validationWarning"></span>
                <iwebmvc:button label="ui.profile.edit.security.changePassword" buttonIcon="/resource.iwebmvc?file=/images/password.gif">
                    changeProfilePassword("<iwebmvc:message argMessage="ui.registration.errorData" />");
                </iwebmvc:button>
            </div>
        </div>
    </div>
</div>